<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>

<rich:panel header="#{messages['booking.label']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{!adminComplimentaryBookingBean.lookupForm}">
		<h:panelGroup>
		    <h:outputText value="#{messages['booking.complimentary.label']}" styleClass="sub_header" />
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>
	
	<t:panelGrid rendered="#{!adminComplimentaryBookingBean.lookupForm}" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="voucherNo" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="voucherNo" value="#{messages['voucher.no.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:inputText size="20" maxlength="20" readonly="true" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.voucherNo}" required="true"></h:inputText>
			<h:commandButton value="#{messages['search']}" styleClass="button" action="null" actionListener="#{adminComplimentaryBookingBean.lookupVoucherFormActionEvent}" immediate="true">
			</h:commandButton>
			<h:inputHidden required="true" id="voucherNo" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.voucherNo}"></h:inputHidden>
		</h:panelGroup>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.memberFlag}" for="membershipNo" value="#{messages['membership.no']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.memberFlag}" id="membershipNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.agreement.member.membershipNo}">
		</t:inputText>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.memberFlag}" for="agreementNo" value="#{messages['agreement.no']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.memberFlag}" id="agreementNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.agreement.agreetmentNo}">
		</t:inputText>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.guestFlag}" for="icNo" value="#{messages['ic.no']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.guestFlag}" id="icNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.guest.icNo}">
		</t:inputText>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.guestFlag}" for="name" value="#{messages['name']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.guestFlag}" id="name" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.guest.name}">
		</t:inputText>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.prospectFlag}" for="icNo2" value="#{messages['ic.no']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.prospectFlag}" id="icNo2" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.prospect.memberRegNo}">
		</t:inputText>
		
		<h:outputLabel rendered="#{adminComplimentaryBookingBean.prospectFlag}" for="name2" value="#{messages['name']}" styleClass="standardText_Label" />
		<t:inputText rendered="#{adminComplimentaryBookingBean.prospectFlag}" id="name2" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucherEntry.prospect.name}">
		</t:inputText>
		
		<h:outputLabel for="voucherIssueDate" value="#{messages['voucher.issue.date.label']}" styleClass="standardText_Label" />
		<t:inputText id="voucherIssueDate" readonly="true" size="10" maxlength="10" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.createdDate}">
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</t:inputText>
		
		<h:outputLabel for="voucherExpiryDate" value="#{messages['voucher.expiry.date.label']}" styleClass="standardText_Label" />
		<t:inputText id="voucherExpiryDate" readonly="true" size="10" maxlength="10" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.expiryDate}">
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</t:inputText>
		
		<h:outputLabel for="voucherNoOfNight" value="#{messages['voucher.no.of.nights.label']}" styleClass="standardText_Label" />
		<t:inputText id="voucherNoOfNight" readonly="true" size="3" maxlength="3" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.noOfNights}">
		</t:inputText>
		
		<h:outputLabel for="noOfPerson" value="#{messages['voucher.no.of.person.label']}" styleClass="standardText_Label" />
		<t:inputText id="noOfPerson" readonly="true" size="3" maxlength="3" styleClass="standardText" value="#{adminComplimentaryBookingBean.voucherEntryDetail.voucher.noOfPerson}">
		</t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="confirmProduct" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="confirmProduct" value="#{messages['booking.confirm.product.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneMenu id="confirmProduct" styleClass="standardText" value="#{adminComplimentaryBookingBean.partnerProduct.partnerProductId}" required="true">
				<f:selectItem itemLabel="#{messages['please.select']}" itemValue="" />
				<f:selectItems value="#{adminComplimentaryBookingBean.selectConfirmProduct}"/>
			</t:selectOneMenu>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="checkIn" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkIn" value="#{messages['booking.checkin.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    	<t:inputCalendar
		    	id="checkIn"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminComplimentaryBookingBean.complimentaryBooking.checkInDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	</t:inputCalendar>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="checkOut" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkOut" value="#{messages['booking.checkout.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    	<t:inputCalendar
		    	id="checkOut"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminComplimentaryBookingBean.complimentaryBooking.checkOutDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	</t:inputCalendar>
		</h:panelGroup>
		
		<h:outputLabel for="extraBed" value="#{messages['booking.extra.bed.label']}" styleClass="standardText_Label" />
		<t:inputText id="extraBed" required="false" size="3" maxlength="3" styleClass="standardText" value="#{adminComplimentaryBookingBean.complimentaryBooking.extraBed}"></t:inputText>
		
		<h:outputLabel for="confirmationNo" value="#{messages['booking.confirmation.no.label']}" styleClass="standardText_Label" />
		<t:inputText id="confirmationNo" required="false" size="20" maxlength="20" styleClass="standardText" value="#{adminComplimentaryBookingBean.complimentaryBooking.confirmationNo}"></t:inputText>
		
		<h:outputLabel for="confirmationDate" value="#{messages['booking.confirmation.date.label']}" styleClass="standardText_Label" />
		<t:inputCalendar
		    	id="confirmationDate"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminComplimentaryBookingBean.complimentaryBooking.confirmationDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="false"
		    	>
		    	</t:inputCalendar>
		
		
		<h:outputLabel for="remark" value="#{messages['booking.remark.label']}" styleClass="standardText_Label" />
		<t:selectOneMenu id="remark" styleClass="standardText" value="#{adminComplimentaryBookingBean.remark.remarkId}" required="false">
				<f:selectItem itemLabel="#{messages['please.select']}" itemValue="" />
				<f:selectItems value="#{adminComplimentaryBookingBean.selectRemark}"/>
		</t:selectOneMenu>
			    	
		<h:outputLabel for="remark" value="#{messages['booking.other.remark.label']}" styleClass="standardText_Label" />		
		<t:inputTextarea styleClass="standardText" cols="20" rows="5" value="#{adminComplimentaryBookingBean.complimentaryBooking.otherRemarks}"></t:inputTextarea>
		
		<rich:spacer height="10"></rich:spacer>
		
		<t:panelGroup>
		   <t:panelGrid columns="2">
		   		<h:commandButton value="#{messages['submit']}" styleClass="button" action="#{adminComplimentaryBookingBean.addComplimentaryBookingAction}" actionListener="#{adminComplimentaryBookingBean.addComplimentaryBookingActionEvent}"></h:commandButton>
			    <h:commandButton value="#{messages['back']}" styleClass="button" action="#{adminComplimentaryBookingBean.initComplimentaryBookingAction}" immediate="true"></h:commandButton>
		   </t:panelGrid>
		</t:panelGroup>
	</t:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{adminComplimentaryBookingBean.lookupForm}" columns="1">
		<h:outputText value="#{messages['voucher.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="data" var="voucherEntryDetail" value="#{adminComplimentaryBookingBean.voucherEntryDetailList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['voucher.no.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminComplimentaryBookingBean.navAddComplimentaryBookingAction}" actionListener="#{adminComplimentaryBookingBean.lookupVoucherFormSelectedActionEvent}">
						<h:outputText value="#{voucherEntryDetail.voucher.voucherNo}"></h:outputText>
					</h:commandLink>
					<f:param id="voucherEntryDetailId" value="#{voucherEntryDetail.voucherEntryDetailId}" />
				</rich:column>	
						
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['voucher.issue.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{voucherEntryDetail.voucher.createdDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
				
			</rich:dataTable>
					
			<rich:spacer height="10"></rich:spacer>
					
			<rich:datascroller align="left"  for="data" maxPages="20" />
			
			<h:commandButton value="#{messages['back']}" styleClass="button" action="null" actionListener="#{adminComplimentaryBookingBean.lookupVoucherFormCloseActionEvent}" immediate="true">
			</h:commandButton>
	</h:panelGrid>
	
</rich:panel>
